package lhs.service;

import lhs.dao.UserDao;
import lhs.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class UserService {
    @Autowired
    UserDao userDao;
    //新增
    public void saveUser(User user){
        userDao.saveUser(user);
    }
    //删除
    public int delUser(int bh){
        return userDao.delUser(bh);
    }
    //数据库记录显示
    public List<User> showAllUser(User user){
         return userDao.showAllUser(user);
    }
    //根据编号获取实体
    public User getUserByBh(int bh){
        return userDao.getUserByBh(bh);
    }
    //修改实体
    public int updateUser(User user){
        int num=userDao.updateUser(user);
        return num;
    }
    //获取总行数
    public int userCount(){
        return userDao.userCount();
    }
    //分页查询
    public List<User> listUserPage(HashMap map){
        List<User> list=userDao.listUserPage(map);
        return list;
    }


    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
}
